package com.stock.demo.framework.ui.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.stock.demo.R;


/**
 * Created by XuZhaoyu on 2017/3/23.
 */

public abstract class StockBaseDialog extends Dialog {

    public StockBaseDialog(Context context) {
        this(context, R.style.custom_dialog);
    }

    public StockBaseDialog(Context context, int themeResId) {
        super(context, themeResId);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(setDialogView());
        setCancelable(setDialogCancelable());

        WindowManager windowManager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
        Window window = this.getWindow();
        initWindow(windowManager, window);
    }

    public abstract void initWindow(WindowManager windowManager, Window window);

    public abstract boolean setDialogCancelable();

    public abstract View setDialogView();

}
